<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>学习笔记定位</title>
    <style>
        .one{
            width: 700px;
          height: 500px;
            background-color: brown;
            position: fixed;/*固定定位相对于浏览器页面进行定位，并且不会随滚动条而滚动*/
            top:50px ;
            left: 150px;
        }
        .two{
            width: 500px;
            height: 450px;
            margin: 5opx auto;
            background-color: aqua;
            position: relative;
        }
      .three{
        width: 300px;
        height: 300px;
        background-color: black;
        position: absolute;/*绝对定位相当于父元素位置进行定位，为防止页面结构改变，必须要在父元素中加上position；releative;并且可以不加边偏移*/
        top: 50px;
        right: 100px;
      }
      .four{
        width: 200px;
        height: 200px;
        background-color: bisque;
       position: relative;/*相对定位，相对与原文档流的标准位置进行定位*/
        top: 100px;
        left: 200px;
      }
      .five{
        width: 200px;
        height:200px;
        border-style: solid;
        position: static;/*静态定位，作为默认情况，标准文本流位置*/
      }/*定位属性值为top left  right bottom 加上数值作为边偏移*/
      .six{
        width: 500px;
        height: 500px;
        border-style: solid;

    background-color: blue;  
    position: relative;
    top: 200px;
    left: 450px;
    z-index: 20;
    }
    .happy{
        width: 100px;
        height: 100px;
        border-style: solid;
        background-color: yellow;
        z-index: -1;/*层叠性优先级，如果想要改变谁在上或在下的问题，可利用z-index改变层叠性的优先级，z-index属性值越大，其层就会在上面，越小，其层会在下面*/
    }
    .new{
        width: 100px;
        height: 100px;
        border-style: solid;
        background-color: cornflowerblue;
        z-index: 5;
    }
    a{
      display: none;
      text-decoration: none;
      font-size: 200px;
      text-align: center;
      
    }
   div:only-child:hover a {
    display: block;
      width: 100px;
      height: 100px;
      border-style: solid;
      color: cadetblue;
      font-size: 500px;
      position: absolute;
      top: 300px;
      left: 500px;
      margin: 600px 800px;
    
    }

    </style>
</head>
<body>
<div class="one">
   <div class="two">01
      <div class="three">02</div>
   </div>
    <div class="four">03</div>
    <div class="five">04</div>
 </div class="six">
 <div class="happy">05</div>
 <div class="new">06</div>
<div> <a href="#">你好</a></div>
 </div>
</body>
</html>